#include <iostream>
#include <vector>
using namespace std;


int main()
{
    vector<int> v{1,2,2,3,4};
    auto it = v.begin();
    while(it != v.end())
    {
        if(*it % 2 == 0)
        {
            v.erase(it);
        }
        ++it;
    }
    return 0;
}

int main()
{
    vector<int> v{1,2,2,3,4};
    auto it = v.begin();
    while(it != v.end())
    {
        if(*it % 2 == 0)
        {
            it = v.erase(it);
        }
        else
        {
            ++it;
        }
    }
    return 0;
}

void teststring()
{
    string s("hello");
    auto it = s.begin();

    //s.resize(20,'*');
    while (it != s.end())
    {
        cout << *it;
        ++it;
    }
    cout << endl;

    it = s.begin();
    while (it != s.end())
    {
        it = s.erase(it);
        //s.erase(it);
        ++it;
    }
}